package summary;

/**
 * @Author: 海琳琦
 * @Date: 2022/4/8 12:21
 */
public class Title263 {

    /**
     * 丑数只包含2,3,5
     * @param n
     * @return
     */
    public static boolean isUgly(int n) {
        if (n <= 0) {
            return false;
        } else if (n == 1) {
            return true;
        }
        if (n % 2 == 0) {
            return isUgly(n / 2);
        }
        if (n % 3 == 0) {
            return isUgly(n / 3);
        }
        if (n % 5 == 0) {
            return isUgly(n / 5);
        }
        return false;
    }

    public static void main(String[] args) {
        boolean ugly = isUgly(14);
        System.out.println(ugly);
    }
}
